<?php
/**
 * JE Career package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.tooltip');

$doc 	= & JFactory::getDocument();
$css    = JURI::base().'components/com_hostingrajacareer/assets/css/style.css';
$doc->addStyleSheet($css);

// check if the controller name is something other than the default, if so, render the submenu appropriately
// note: the second argument in the addEntry helper function is weather or not the sub menu item is active

$controllerName = JRequest::getCmd( 'controller', 'category' );
$control = '';

switch($controllerName) {

case 'career':
		JSubMenuHelper::addEntry(JText::_('JE_CATEGORIES'), 'index.php?option=com_hostingrajacareer&controller=category');
		JSubMenuHelper::addEntry(JText::_('JE_CURRENT_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=career', true);
		JSubMenuHelper::addEntry(JText::_('JE_APPLIED_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=applied_openings');
		JSubMenuHelper::addEntry(JText::_('JE_GLOBALSETTINGS'), 'index.php?option=com_hostingrajacareer&controller=globalsettings');
		$control = 'career';
		break;

case 'applied_openings':
		JSubMenuHelper::addEntry(JText::_('JE_CATEGORIES'), 'index.php?option=com_hostingrajacareer&controller=category');
		JSubMenuHelper::addEntry(JText::_('JE_CURRENT_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=career');
		JSubMenuHelper::addEntry(JText::_('JE_APPLIED_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=applied_openings', true);
		JSubMenuHelper::addEntry(JText::_('JE_GLOBALSETTINGS'), 'index.php?option=com_hostingrajacareer&controller=globalsettings');
		$control = 'applied_openings';
		break;

case 'category':
		JSubMenuHelper::addEntry(JText::_('JE_CATEGORIES'), 'index.php?option=com_hostingrajacareer&controller=category', true);
		JSubMenuHelper::addEntry(JText::_('JE_CURRENT_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=career');
		JSubMenuHelper::addEntry(JText::_('JE_APPLIED_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=applied_openings');
		JSubMenuHelper::addEntry(JText::_('JE_GLOBALSETTINGS'), 'index.php?option=com_hostingrajacareer&controller=globalsettings');
		$control = 'category';
		break;

case 'globalsettings':
		JSubMenuHelper::addEntry(JText::_('JE_CATEGORIES'), 'index.php?option=com_hostingrajacareer&controller=category');
		JSubMenuHelper::addEntry(JText::_('JE_CURRENT_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=career');
		JSubMenuHelper::addEntry(JText::_('JE_APPLIED_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=applied_openings');
		JSubMenuHelper::addEntry(JText::_('JE_GLOBALSETTINGS'), 'index.php?option=com_hostingrajacareer&controller=globalsettings', true);
		$control = 'globalsettings';
		break;

	default:
		JSubMenuHelper::addEntry(JText::_('JE_CATEGORIES'), 'index.php?option=com_hostingrajacareer&controller=category', true);
		JSubMenuHelper::addEntry(JText::_('JE_CURRENT_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=career');
		JSubMenuHelper::addEntry(JText::_('JE_APPLIED_OPENINGS'), 'index.php?option=com_hostingrajacareer&controller=applied_openings');
		JSubMenuHelper::addEntry(JText::_('JE_GLOBALSETTINGS'), 'index.php?option=com_hostingrajacareer&controller=globalsettings');

		$control = 'category';
		break;
}

require_once( JPATH_COMPONENT.DS.'controllers'.DS.$controllerName.'.php' );
$controllerName = 'hostingrajacareerController'.$controllerName;

// Create the controller
$controller 	= new $controllerName();

// Perform the Request task
$controller->execute( JRequest::getCmd('task') );

// Redirect if set by the controller
$controller->redirect();
?>